package com.example.frickytest;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import android.content.Intent;
import android.view.MenuItem;

public class MenuActivity extends Activity {


	private Button button_taijyuu;
	private Button button_picture;
	private Button button_thread;
	private Button button_ipc;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_menu);
        
        button_taijyuu = (Button) findViewById(R.id.button_taijyuu);
        button_picture = (Button) findViewById(R.id.button_picture);
        button_thread = (Button) findViewById(R.id.button_thread);
        button_ipc = (Button) findViewById(R.id.button_ipc);
        
        button_taijyuu.setOnClickListener(new Button.OnClickListener() {

			public void onClick(View v) {
				Intent intent = new Intent();
				intent.setClass(MenuActivity.this, MainActivity.class);
				startActivity(intent);				
			}       	
        });
        
        button_picture.setOnClickListener(new Button.OnClickListener(){
        	public void onClick(View v) {
				Intent intent = new Intent();
				intent.setClass(MenuActivity.this, PictureActivity.class);
				startActivity(intent);				
			}  
        });
        
        button_thread.setOnClickListener(new Button.OnClickListener(){
        	public void onClick(View v) {
				Intent intent = new Intent();
				intent.setClass(MenuActivity.this, ThreadActivity.class);
				startActivity(intent);				
			}  
        });
        
        button_ipc.setOnClickListener(new Button.OnClickListener(){
        	public void onClick(View v) {
				Intent intent = new Intent();
				intent.setClass(MenuActivity.this, IPCActivity.class);
				startActivity(intent);				
			}  
        });
        
    }

    public boolean onCreateOptionsMenu(Menu menu) {
    	super.onCreateOptionsMenu(menu);
    	menu.add(0, 1, 0, R.string.menu_toPlay);
    	menu.add(0, 2, 0, R.string.menu_toStop);
    	return true;
    }
    
	public boolean onOptionsItemSelected(MenuItem item) {

		if (item.getItemId() == 1) {
			Toast.makeText(MenuActivity.this, R.string.menu_toPlay, Toast.LENGTH_SHORT)
					.show();
		}
		if (item.getItemId() == 2) {
			Toast.makeText(MenuActivity.this, R.string.menu_toStop, Toast.LENGTH_SHORT)
					.show();
		}
		return super.onOptionsItemSelected(item);
	}
}
